package com.vcc.data.base.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.keygen.KeyGenerators;
import com.vcc.core.util.JsonUtil;
import lombok.*;
import org.apache.ibatis.type.JdbcType;

import java.util.Date;

@Data
@Getter
@Setter
public class BaseEntity {


    @Id(keyType = KeyType.Generator, value = KeyGenerators.flexId)
    private Long id;

    @Column(comment= "创建时间",value = "create_date",jdbcType = JdbcType.TIMESTAMP,onInsertValue = "now()")
    private Date createDate;

    @Column(comment= "修改时间",value = "update_date",jdbcType = JdbcType.TIMESTAMP,onUpdateValue = "now()")
    private Date  updateDate;


    public String toJson() {
        return JsonUtil.toJson(this);
    }
}
